//
//  RelationVC.m
//  HxgProject
//
//  Created by hxg on 2018/3/10.
//  Copyright © 2018年 XMYY-19. All rights reserved.
//

#import "RelationVC.h"

@interface RelationVC ()

@property (nonatomic, strong) NSMutableArray *relationArr;

// 选中的信息
@property (nonatomic, strong) NSIndexPath *selectIndexPath;

@end

@implementation RelationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"关系选择";
    
    self.tableView.tableFooterView = [[UIView alloc] init];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.relationArr.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kDefaultCellHeight;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *cellId = @"cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.textLabel.text = self.relationArr[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    self.relationCallBack(self.relationArr[indexPath.row]);
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark -
-(NSMutableArray *)relationArr
{
    if (!_relationArr)
    {
        _relationArr = [[NSMutableArray alloc] initWithObjects:@"父母",@"亲属",@"同学",@"朋友", nil];
    }
    return _relationArr;
}

@end
